import { ExtensionContext } from 'vscode';
import { ExplorerConst } from '../constants';
import { IExplorer } from '../interface';
import { SystemList } from './system-list/system-list';

// 已实例化的资源管理器
const explorers: Map<string, IExplorer<unknown>> = new Map();

/**
 * 安装 资源管理器
 *
 * @author chitanda
 * @date 2021-11-30 10:11:47
 * @export
 * @param {ExtensionContext} context
 */
export function installExplorer(context: ExtensionContext): void {
  explorers.set(ExplorerConst.SYSTEM_LIST, new SystemList(context));
}

/**
 * 获取模型导航管理器
 *
 * @author chitanda
 * @date 2021-12-22 15:12:19
 * @export
 * @return {*}  {ModelExpTree}
 */
export function getModelExpTree(): SystemList {
  return explorers.get(ExplorerConst.SYSTEM_LIST) as SystemList;
}

export { SystemList };
